package band.wukong.practice.springboot.spring4.basic.profile;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

/**
 * @author wukong(wukonggg@139.com)
 */
public class SpringProfileSample {

    private static final Logger logger = LoggerFactory.getLogger(SpringProfileSample.class);

    public static void main(String[] args) {
        AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext();

        context.getEnvironment().setActiveProfiles(ProfileConst.DEV);
//        context.getEnvironment().setActiveProfiles(ProfileConst.PROD);
        context.register(ProfileConfig.class);
        context.refresh();

        ProfileBean demoBean = context.getBean(ProfileBean.class);
        logger.info("demoBean.getContent() = " + demoBean.getContent());

        context.close();
    }

}
